package com.guaju.yueshangLife.activity;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;

import com.githang.statusbar.StatusBarCompat;
import com.guaju.yueshangLife.R;
import com.guaju.yueshangLife.base.MyAppcomActivity;
import com.guaju.yueshangLife.databinding.ActivityFindPasswordBinding;
import com.guaju.yueshangLife.viewmodel.login.FindPasswordVM;

public class FindPasswordActivity extends MyAppcomActivity {
    private ActivityFindPasswordBinding binding;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_find_password);
        //一体栏
        StatusBarCompat.setStatusBarColor(this, getResources().getColor(R.color.home_background));
        FindPasswordVM findPasswordVM = new FindPasswordVM();
        binding.setViewmodel(findPasswordVM);
        initView();
    }

    private void initView() {
        binding.etVerifycode.addTextChangedListener(new FindPasswordActivity.LoginTextWatch());
    }

    public class LoginTextWatch implements TextWatcher {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {

        }

        @Override
        public void afterTextChanged(Editable s) {
            if (s.toString().length() > 0) {
                binding.btNextStep.setBackgroundResource(R.drawable.selector_login_button);
            } else {
                binding.btNextStep.setBackgroundResource(R.drawable.shape_login_unable_bg);
            }
        }
    }
}
